<?php
// No direct access
defined ('_JEXEC') or die();

jimport ('joomla.application.component.modellist');

class ShipnhanhModelHandseltracking extends JModelList
{
	public function __construct($config = array())
	{
		parent::__construct();
	}
	
	protected function getListQuery()
	{
		$user = JFactory::getUser();
		$db = JFactory::getDBO();
		$query = $db->getQuery(true);
		
		$query->select('h.id, h.date, h.comment, h.amount');
		$query->from('#__sn_prepaid AS p');
		$query->join('INNER','#__sn_prepaid_history AS h ON (p.id = h.prepaidid)');
		$query->where('p.email LIKE ' . $db->quote('%' . $user->email . '%'));
		$query->order('h.date DESC');
		
		return $query;
	}
}